package com.baizhi.day01;

/**
 * 车的测试类
 */
public class CarTest {
    public static void main(String[] args) {
        //创建一个车对象
        Car car1 = new Car();
        //访问对象的属性，并给对象的属性初始化
        car1.brand = "奔驰";
        car1.color = "红";
        car1.price = 400000;

        //访问对象的属性，打印对象的属性
        System.out.println(car1.brand);
        System.out.println(car1.color);
        System.out.println(car1.price);

        //调用对象的方法
        car1.start();
        car1.run();
        car1.stop();


        System.out.println("-------------------------");
        //创建car2对象
        Car car2 = new Car();
        //访问car2的属性并初始化
        car2.brand = "宝马";
        car2.color = "黑";
        car2.price = 1000000.0;
        //调用car2的方法
        car2.start();
        car2.run();
        car2.stop();

        System.out.println("----------------");
        //创建car3对象
        Car car3 = new Car();
        //访问car3的属性并初始化
        car3.brand = "马萨拉蒂";
        car3.price = 5000000.0;
        car3.color = "蓝";

        //调用car3的方法
        car3.start();
        car3.run();
        car3.stop();

    }
}
